Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding cctp integration test #1601

Open
wants to merge 6 commits into
base: development
Choose a base branch
from
Open

adding cctp integration test #1601

wants to merge 6 commits into from

Conversation

haider-rs
Copy link
Contributor

@haider-rs haider-rs commented Feb 26, 2025

  • Add cctp integration test
  • Take CCTP contracts list instead of single contract.

@haider-rs haider-rs self-assigned this Feb 26, 2025
@haider-rs haider-rs linked an issue Feb 26, 2025 that may be closed by this pull request
@haider-rs haider-rs requested a review from dvc94ch February 27, 2025 07:14
@haider-rs haider-rs marked this pull request as ready for review February 27, 2025 13:59
Comment on lines +82 to +83
ports:
- '8545:8545'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work in ci...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets please avoid portforwarding

@@ -94,9 +96,13 @@ services:
- '--target-url=ws://chain-2-evm:8545'
- '--network-id=2'
- '--backend=evm'
- '--cctp-sender=000000000000000000000000ab5976445202ac58cdf7da9cb5797a70e6be1cdc'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this generated?

Comment on lines +829 to +840
let nonce = self.get_gateway_nonce(gateway, contract).await?;
let mut msg = sol::GmpMessage {
srcNetwork: self.network_id,
source: contract.into(),
destNetwork: dest_network,
dest: a_addr(dest),
nonce,
gasLimit: gas_limit as _,
data: cctp_msg.clone().abi_encode().into(),
};
let call = sol::GmpTester::sendMessageCall { msg: msg.clone() };
let _ = self.evm_call(contract, call, gas_cost, None, None).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't you use tc.send_message() here?

Comment on lines +842 to +853
// Computing valid message id for CCTP requires adding attestation in the cctp struct and then compute message_id
// Since after getting attestation the message_id of the gmp message changes we get attestation in start to match the later message_id.
let burn_hash: [u8; 32] = sha3::Keccak256::digest(&msg_data).into();
let response = self.get_cctp_attestation(burn_hash).await?;
let attestation =
response.attestation.ok_or(anyhow::anyhow!("Failed to get msg attestation"))?;
let attestation = attestation.strip_prefix("0x").unwrap_or(&attestation);
let attestation_bytes = hex::decode(attestation).unwrap();
cctp_msg.attestation = attestation_bytes.into();
msg.data = cctp_msg.abi_encode().into();
let message_id = Into::<GmpMessage>::into(msg).message_id();
Ok(message_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

message id shouldn't depend on the payload if backends are allowed to change it. since the changed message is tss signed, this isn't a security issue either

async fn deploy_test(&self, gateway: Address, tester: &[u8]) -> Result<(Address, u64)> {
async fn deploy_test(
&self,
_additional_params: &[u8],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Comment on lines +1043 to +1082
#[allow(clippy::too_many_arguments)]
pub async fn send_cctp_message(
&self,
src_network: NetworkId,
src_addr: Address,
dest_network: NetworkId,
dest_addr: Address,
gas_limit: u128,
gas_cost: u128,
) -> Result<MessageId> {
let (connector, gateway) = self.gateway(src_network).await?;
let id = self
.println(
None,
format!(
"send cctp message to {} {} with {} gas for {}",
dest_network,
self.format_address(Some(dest_network), dest_addr)?,
gas_limit,
self.format_balance(Some(src_network), gas_cost)?,
),
)
.await?;
let msg_id = connector
.send_cctp_message(gateway, src_addr, dest_network, dest_addr, gas_limit, gas_cost)
.await?;
self.println(
Some(id),
format!(
"sent cctp message {} to {} {} with {} gas for {}",
hex::encode(msg_id),
dest_network,
self.format_address(Some(dest_network), dest_addr)?,
gas_limit,
self.format_balance(Some(src_network), gas_cost)?,
),
)
.await?;
Ok(msg_id)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this unnecessarily duplicates send_message

src_addr: Address,
dest: NetworkId,
dest_addr: Address,
smoke_type: SmokeType,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
smoke_type: SmokeType,
payload: Vec<u8>,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cctp integration test
2 participants